#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,ans,ma,ha;
int a[100010],gj[100010],b[100010];
signed main(){
    freopen("duel.in","r",stdin);
    freopen("duel.out","w",stdout);
    ios::sync_with_stdio(0);
    cin.tie(0); cout.tie(0);
    cin>>n;
    for(int i=1;i<=n;i++) cin>>a[i];
    sort(a+1,a+1+n);
    for(int i=1;i<=n;i++){
        if(a[i]!=a[i-1]) b[i]=b[i-1]+1;
        else b[i]=b[i-1];
        ma=max(ma,b[i]);
    }
    for(int i=1;i<=n;i++) gj[b[i]]++;
    for(int i=1;i<=ma;i++){
        ans+=min(ha,gj[i]);
        ha-=min(ha,gj[i]);
        ha+=gj[i];
    }
    cout<<n-ans<<'\n';
    return 0;
}
